package hong.jun.data.role;

import dev.morphia.annotations.*;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * 角色
 * 
 * @author zhaowei
 *
 */
@Entity(value = "admin_role", noClassnameStored = true)
@Indexes(@Index(fields = { @Field(value = "name") }, options = @IndexOptions(unique = true)))
public class Role implements Serializable {

	private static final long serialVersionUID = -3527006726976890876L;
	// 角色id
	@Id
	private long roleId;
	// 角色名
	private String name;
	// 所拥有过的菜单编号
	private Set<Long> menus = new HashSet<>();
	// 是否删除
	private boolean del;

	public long getRoleId() {
		return roleId;
	}

	public void setRoleId(long roleId) {
		this.roleId = roleId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Set<Long> getMenus() {
		return menus;
	}

	public void setMenus(Set<Long> menus) {
		this.menus = menus;
	}

	public boolean isDel() {
		return del;
	}

	public void setDel(boolean del) {
		this.del = del;
	}

	@Override
	public String toString() {
		return "Role{" +
				"roleId=" + roleId +
				", name='" + name + '\'' +
				", menus=" + menus +
				", del=" + del +
				'}';
	}
}
